Skip to content

feat(native): add toHaveStyle #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: feat/native-to-have-prop
Choose a base branch
from

Conversation

ACR1209
Copy link

@ACR1209 ACR1209 commented Jun 2, 2025

Description

This PR adds the toHaveStyle matcher for the React Native module

@ACR1209 ACR1209 requested a review from suany0805 June 2, 2025 17:23

const error = new AssertionError({
actual: this.actual,
message: `Expected element ${this.toString()} to have style ${JSON.stringify(flattenedStyle)}.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there could be a different way of hanlding the style object to string? since that is what users will be reading when a test fails, it should be clear and readable :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would something like this work for us, or do you have a specific error message in mind?

Expected element <View ... /> to have style:
-"background_color": red
-"color": white

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants